<?php /* Smarty version Smarty-3.1.18, created on 2014-09-09 09:04:30
         compiled from "application\views\cart.php" */ ?>
<?php /*%%SmartyHeaderCode:10320540eb8948ddca9-89603894%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    '4660246103f8f9bda08e48580ecb884439172a07' => 
    array (
      0 => 'application\\views\\cart.php',
      1 => 1410253467,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '10320540eb8948ddca9-89603894',
  'function' => 
  array (
  ),
  'version' => 'Smarty-3.1.18',
  'unifunc' => 'content_540eb8949ef331_31720225',
  'variables' => 
  array (
    'data' => 0,
    'site_url' => 0,
    'item' => 0,
    'eachtotal' => 0,
    'subtotal' => 0,
  ),
  'has_nocache_code' => false,
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_540eb8949ef331_31720225')) {function content_540eb8949ef331_31720225($_smarty_tpl) {?>
<!--container begin-->
<script type="text/javascript">

function postqty(qty,th,th_price){

	var old_qty = $("#qty"+th).val();
	
	var current_qty = parseInt(old_qty)+parseInt(qty);

	if(current_qty<1)return;

	$("#qty"+th).val(current_qty);
	
	var tot = current_qty*th_price;
	
	$("#sub_tot_dis"+th).html(tot.toFixed(2));

	$.post("/changeqty",{product_id:th,qty:current_qty},function(msg){

		number = parseInt(msg);

		$("#sub_tot").html(number.toFixed(2));
	  	  
	});

}

function isNumberKey(evt)
{   
	  var charCode = (evt.which) ? evt.which : event.keyCode;
	  if (charCode = 46 && charCode > 31 && (charCode < 48 || charCode > 57))
	  return false;
}

function change_qty(th,th_price)
{	
	var qty=$("#qty"+th).val();
	var tot=qty*th_price;
	$("#sub_tot_dis"+th).html(tot.toFixed(2));
	var qstring = 'qty='+qty+'&product_id='+th;
	$.ajax({  
		type: "POST",  
		url: "/changeqty",  
		data: qstring ,
		success: function(msg){	
		number = msg;		
		$("#sub_tot").html(number.toFixed(2));
		} 
	}); 

}

  </script>




<div id="container" class="fix">
	<div class="icontainer"><div class="crumb">
		<a href="/">Home</a>
		&gt; Shopping Basket
	</div>
		<div class="cartWrapper">
			<div class="cartPro">
				<h3>Shopping Basket</h3>
				<div class="bagArea">
					<div class="itmetotal">
						Your Shopping Basket Contains
						<span><?php echo $_smarty_tpl->tpl_vars['data']->value['item'];?>
 Item(s)</span>
					</div>
					<table class="cartTable">
						<tr class="title">

							<th class="itemDetail">Product Name</th>

							<th class="bagQty">Qty</th>
							<th class="bagPrice">Price Each</th>
							<th class="totalPrice">Subtotal</th>
							<th class="action">Remove</th>
						</tr>
              <?php $_smarty_tpl->tpl_vars['subtotal'] = new Smarty_variable(0, null, 0);?>
              
              <?php if ($_smarty_tpl->tpl_vars['data']->value['products']) {?>
              <?php  $_smarty_tpl->tpl_vars['item'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['item']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['data']->value['products']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['item']->key => $_smarty_tpl->tpl_vars['item']->value) {
$_smarty_tpl->tpl_vars['item']->_loop = true;
?>
              <tr>

							<td class="itemDetail">
								<div class="itemImg">
									<a href="<?php echo $_smarty_tpl->tpl_vars['site_url']->value;?>
product/<?php echo $_smarty_tpl->tpl_vars['item']->value['prourl'];?>
">
										<img src="<?php echo $_smarty_tpl->tpl_vars['site_url']->value;?>
img/simg/<?php echo $_smarty_tpl->tpl_vars['item']->value['img'];?>
" alt="" width="60" height="60" />
									</a>
								</div>
								<div class="itemText">
									<a href="<?php echo $_smarty_tpl->tpl_vars['site_url']->value;?>
product/<?php echo $_smarty_tpl->tpl_vars['item']->value['prourl'];?>
" title=""><?php echo $_smarty_tpl->tpl_vars['item']->value['proname'];?>
</a>
								</div>
							</td>
				
							
							<td class="bagQty">
								
								<input type="text" id="qty<?php echo $_smarty_tpl->tpl_vars['item']->value['pro_id'];?>
" class="qtyInput" size="3" value="<?php echo $_smarty_tpl->tpl_vars['item']->value['qty'];?>
" name="" 
								onblur="this.value=!this.value?'0':this.value;" onfocus="if (this.value == '0') {this.value=''}" 
								onkeypress="return isNumberKey(event)" onkeyup="change_qty(<?php echo $_smarty_tpl->tpl_vars['item']->value['pro_id'];?>
,<?php echo $_smarty_tpl->tpl_vars['item']->value['price'];?>
);"/>
								
							</td>			
							
							<td class="bagPrice color01">$<?php echo $_smarty_tpl->tpl_vars['item']->value['price'];?>
</td>
							<td class="totalPrice color01">$<span id="sub_tot_dis<?php echo $_smarty_tpl->tpl_vars['item']->value['pro_id'];?>
"><?php $_smarty_tpl->tpl_vars['eachtotal'] = new Smarty_variable($_smarty_tpl->tpl_vars['item']->value['price']*$_smarty_tpl->tpl_vars['item']->value['qty'], null, 0);?><?php echo $_smarty_tpl->tpl_vars['eachtotal']->value;?>
 <?php $_smarty_tpl->tpl_vars['subtotal'] = new Smarty_variable($_smarty_tpl->tpl_vars['eachtotal']->value+$_smarty_tpl->tpl_vars['subtotal']->value, null, 0);?></span></td>
							<td class="action">
								<a href="/del_from_cart/<?php echo $_smarty_tpl->tpl_vars['item']->value['pro_id'];?>
"
									class="del">delete</a>
							</td>
						</tr>
              <?php } ?>
              <?php }?>           
            </table>

					<form action="/shipaddress" method="post">
						
						<div class="totalArea">
							<p>Basket Subtotal: $<span id="sub_tot"><?php echo $_smarty_tpl->tpl_vars['subtotal']->value;?>
</span></p>
						</div>
						<div class="cartBtn fix ">
							<a href="/" class="continueBtn">Continue Shopping</a>
							<input type="submit" class="checkoutBtn"
								value="Proceed to Checkout" <?php if ($_smarty_tpl->tpl_vars['data']->value['item']==0) {?> disabled='disabled' <?php }?>/>
					
					</form>
				</div>
			</div>
		</div>
	</div>

</div>
</div>
<!--container end--><?php }} ?>
